package andrei.mower2.business.output;

import andrei.mower2.business.MowerDriveResult;
import andrei.mower2.main.i18n.MessageUtils;

public class ConsoleOutputter implements MowerDriveResultOutputter {
	
	private static final int MAX_OUTPUTTED_LINES = 99;
	
	private int outputtedLinesCount;
	
	private boolean warnIssued;
	
	@Override
	public void output(MowerDriveResult result) {
		if(outputtedLinesCount < MAX_OUTPUTTED_LINES) {
			System.out.println(result.toOutputString());
			outputtedLinesCount++;
		} else if(!warnIssued) {
			System.out.println(MessageUtils.getMessage("warn.io.tooManyConsoleOutputLines"));
			warnIssued = true;
		}
	}

	@Override
	public void close() {}

}
